<template>
  <el-dialog
    v-model="visible"
    title="提示信息"
    width="500px"
    :close-on-click-modal="false"
    :destroy-on-close="true"
    :attr="$attrs"
    :before-close="handleClose"
  >
    <div v-if="type === 'single'">确定要删除这条数据吗？</div>
    <div v-if="type === 'batch'">确定要删除所选数据吗？</div>

    <template #footer>
      <div class="dialog-footer">
        <el-button @click="visible = false">取消</el-button>
        <el-button type="primary" @click="handleConfirm">
          确认
        </el-button>
      </div>
    </template>
  </el-dialog>
</template>

<script setup>
defineProps({
  type: {
    type: String,
    default: 'single'
  }
})
const emits = defineEmits(['close', 'confirm'])
const visible = defineModel(false)

const handleClose = () => {
  visible.value = false
  emits('close')
}
const handleConfirm = () => {
  emits('confirm')
}
</script>

<style lang="scss" scoped>

</style>
